import { createBrowserRouter, Navigate } from "react-router-dom";
import LoginPage from "../pages/Login";
import MainLayout from "../components/Layout/MainLayout";
import ProtectedRoute from "../components/ProtectedRoute";
import DashboardHome from "../pages/Dashboard/Home";
import KnowledgeGraphPage from "../pages/Dashboard/KnowledgeGraph";
import DataManagement from "../pages/Dashboard/DataManagement";
import RelationManagement from "../pages/Dashboard/RelationManagement";
import DataImport from "../pages/Dashboard/DataImport";
import Analytics from "../pages/Dashboard/Analytics";
import Settings from "../pages/Dashboard/Settings";
import Help from "../pages/Dashboard/Help";

const router = createBrowserRouter([
  {
    path: "/",
    element: <Navigate to="/dashboard/home" replace />,
  },
  {
    path: "/login",
    element: <LoginPage />,
  },
  {
    path: "/dashboard",
    element: (
      <ProtectedRoute>
        <MainLayout />
      </ProtectedRoute>
    ),
    children: [
      {
        path: "/dashboard",
        element: <DashboardHome />,
      },
      {
        path: "/dashboard/home",
        element: <DashboardHome />,
      },
      {
        path: "/dashboard/knowledge-graph",
        element: <KnowledgeGraphPage />,
      },
      {
        path: "/dashboard/data-management",
        element: <DataManagement />,
      },
      {
        path: "/dashboard/relation-management",
        element: <RelationManagement />,
      },
      {
        path: "/dashboard/data-import",
        element: <DataImport />,
      },
      {
        path: "/dashboard/analytics",
        element: <Analytics />,
      },
      {
        path: "/dashboard/settings",
        element: <Settings />,
      },
      {
        path: "/dashboard/help",
        element: <Help />,
      },
    ],
  },
]);

export default router;
